import request from '@/config/axios'

export interface MemberUserVO {
  id:number,
  code: String,
  mobile: String,
  avatar: String,
  nickname: String,
  sex: number,
  recentConsumptionTime: Date,
  storeNotConsumptionDay: number,
  storeOrderPrice: number,
  storeOrderCount: number,
  homeNotConsumptionDay: number,
  homeOrderPrice: number,
  homeOrderCount: number,
  age: number,
  birthdayStr: String,
  homeRemark: String,
  storeRemark: String
}

// 查询用户分页
export const getMemberUserPage = async (params) => {
  return await request.get({ url: `/meijia/member-user/page`, params })
}

// 查询用户详情
export const getMemberUser = async (id: number) => {
  return await request.get({ url: `/meijia/member-user/get?id=` + id })
}
// 查询用户详情
export const getMemberUserDetail = async (id: number) => {
  return await request.get({ url: `/meijia/member-user/get-member-user-detail?id=` + id })
}
// 新增用户
export const createMemberUser = async (data: MemberUserVO) => {
  return await request.post({ url: `/meijia/member-user/create`, data })
}

// 修改用户
export const updateMemberUser = async (data: MemberUserVO) => {
  return await request.put({ url: `/meijia/member-user/update`, data })
}

// 删除用户
export const deleteMemberUser = async (id: number) => {
  return await request.delete({ url: `/meijia/member-user/delete?id=` + id })
}

// 导出用户 Excel
export const exportMemberUser = async (params) => {
  return await request.download({ url: `/meijia/member-user/export-excel`, params })
}

// 修改到家描述
export const updateHomeRemark = async (data: MemberUserVO) => {
  return await request.put({ url: `/meijia/member-user/update-home-remark`, data })
}
// 修改到店描述
export const updateStoreRemark = async (data: MemberUserVO) => {
  return await request.put({ url: `/meijia/member-user/update-store-remark`, data })
}